// 店铺

import request from '@/utils/request'
import R from '@/types/conduit/R'
import { SettleInParam } from '@/types/param/settle-in'
import { ShopBasicInfo, ShopBusinessConfig, ShopBusinessConfigVO } from '@/types/response/shop'

export const settleIn = (SettleInParam: SettleInParam): Promise<R<null>> =>
  request({
    url: `/shop/shop/settleIn`,
    method: 'POST',
    data: SettleInParam
  })
export const testLogin = (): Promise<R<null>> =>
  request({
    url: `/shop/shop/test`,
    method: 'GET'
  })

export const getShopBusinessStatus = (): Promise<R<number>> =>
  request({
    url: `/shop/shop/status`,
    method: 'GET'
  })

export const changeShopStatus = (businessStatus: number): Promise<R<boolean>> =>
  request({
    url: `/shop/shop/changeShopStatus`,
    method: 'POST',
    params: { businessStatus }
  })
/**
 * 发送验证码接口
 * @param cityCode
 * @returns
 */
export const sendSettleInPhoneCode = (phone: string): Promise<R<null>> =>
  request({
    url: `/shop/shop/sendSettleInPhoneCode`,
    method: 'GET',
    params: { phone }
  })

export const shopBasicInfo = (): Promise<R<ShopBasicInfo>> =>
  request({
    url: `/shop/shop/shop-basic-info`,
    method: 'GET'
  })
export const updateShopBasicInfo = (shopBasicInfo: ShopBasicInfo): Promise<R<ShopBasicInfo>> =>
  request({
    url: `/shop/shop/shop-basic-info`,
    data: shopBasicInfo,
    method: 'PUT'
  })

export const shopBusinessConfig = (): Promise<R<ShopBusinessConfigVO>> =>
  request({
    url: `/shop/shop/business-config`,
    method: 'GET'
  })
export const updateShopBusinessConfig = (shopBusinessConfig: ShopBusinessConfig): Promise<R<null>> =>
  request({
    url: `/shop/shop/business-config`,
    data: shopBusinessConfig,
    method: 'PUT'
  })
